
package com.bootx.service.impl;

import com.bootx.dao.ToolCategoryDao;
import com.bootx.entity.ToolCategory;
import com.bootx.service.ToolCategoryService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

/**
 * Service - 管理员
 * 
 * @author 好源++ Team
 * @version 6.1
 */
@Service
public class ToolCategoryServiceImpl extends BaseServiceImpl<ToolCategory, Long> implements ToolCategoryService {

    @Resource
    private ToolCategoryDao toolCategoryDao;

    @Override
    public ToolCategory create(String type) {
        ToolCategory toolCategory = toolCategoryDao.find("name", type);
        if(toolCategory==null){
            ToolCategory toolCategory1 = new ToolCategory();
            toolCategory1.setName(type);
            return super.save(toolCategory1);
        }

        return toolCategory;
    }
}